﻿@{
//Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script>
        var url1 = "http://" + window.location.host + "/api/apidemo";
        function submitbtn() {
            $.ajax({
                url: url1,
                type: "GET",
                success: function (data) {
                    $("#div1").html(data);
                }
            });
        }
        function submitbtn2() {
            $.getJSON(url1 + "/1", function (data) {
                $("#div1").html(data);
            })
        }
        function submitbtn4() {
            $.ajax({
                url: url1,
                type: "get",
                data: {
                    "id": 1,
                    "a": "a1",
                    "b": "b1",
                    "c": "c1"
                },
                success: function (data) {
                    $("#div1").html(data);
                }

            })
        }
        function post3() {
            $.ajax({
                url: url1,
                type: "post",
                data: {
                    "id": 1,
                    "a": "a1",
                    "b": "b1",
                    "c": "c1",
                    "abc_sub": [
                        {
                            "type": "sample type 1",
                            "value": "sample value 1"
                        },
                        {
                            "type": "sample type 2",
                            "value": "sample value 2"
                        }
                    ]
                },
                success: function (data) {
                    $("#div1").html(data);
                }

            })
        }

    </script>
</head>
<body>
    <div>
        <div id="div1"></div>
        <input type="button" value="获取get方法" onclick="submitbtn()" />
        <input type="button" value="获取get2方法" onclick="submitbtn2()" />
        <input type="button" value="获取get4方法" onclick="submitbtn4()" />
        <input type="button" value="获取post3方法" onclick="post3()" />
    </div>
</body>
</html>
